<script setup lang="ts">
import { publishArticle } from '@/api/community';
import { Article } from '@/api/community/type';
import Close from '@/components/icons/community/Close.vue';
import { router } from '@/router';
import { Ref } from 'vue';

const article = defineModel() as Ref<Article>;

const back = () => {
    router.back();
}

const onSubmit = () => {
    console.log(article.value);
    publishArticle(article.value);
}

</script>

<template>
    <div class="container-icon">
        <Close @click="back"></Close>
        <div class="button">
            <van-button style="width: 100%; height: 100%;" type="primary" round @click="onSubmit">发布</van-button>
        </div>
    </div>
</template>

<style lang="scss" scoped>
.container-icon {
    display: flex;
    background-color: white;
    flex-basis: 50px;
    align-items: center;
    padding-left: 10px;
    padding-right: 10px;
    justify-content: space-between;
    .button {
        width: 70px;
        height: 30px;
    }
}
</style>